package com.luyi.springcloud.controller;

import com.luyi.consumer.api.entity.CommonResult;
import com.luyi.consumer.api.entity.Payment;
import com.luyi.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 卢意
 * @create 2020-10-25 10:13
 */
@RestController
@Slf4j
public class openFeignController {

	@Resource
	private PaymentFeignService paymentFeignService;

	@GetMapping(value = "/consumer/payment/get/{id}")
	public CommonResult<Payment> getPaymentById(@PathVariable(value = "id")Long id){
		return paymentFeignService.getPaymentById(id);
	}


	@GetMapping(value = "/consumer/payment/feign/timeout")
	public String paymentFeignTimeOut(){
		//客户端一般默认一秒等待时间
		return paymentFeignService.paymentFeignTimeOut();
	}
}
